$(".select-box ul").on('click','li',function(){
    $(this).parent().siblings('.show').val($(this).html());
    $(this).parent().siblings('.hidden').val($(this).attr('data-id'));
});
$(".select-box div.fl").click(function(e){
    console.log('ss');
    e.stopPropagation();
    var div=$(this);
    div.children('ul').toggleClass('hide');
    $(document).click(function() {
        if (!div.children('ul').hasClass("hide")) {
            div.children('ul').addClass("hide");
        }
    });
});
//w调用日期选择插件
$('#datePicker').daterangepicker();
$('body').on('click','.applyBtn',function(){
    var date = $('#datePicker').val();
    console.log(date);
    arr=date.split(" - "); 
    var startDate = arr[0];
    var endDate = arr[1];
   $("#startdate").val(startDate);
   $("#enddate").val(endDate);
   console.log(startDate,endDate);
   window.location.href = "/DistributorSystem/finance/findRefundRecordList?start="+startDate+"&end="+endDate;
 });

//搜索商品
$('.search-box span').click(function(){
    var keyWord=$(this).siblings('input').val();
    console.log(keyWord);
    window.location.href = "/DistributorSystem/finance/findRefundRecordList?condition="+keyWord;
});




$(function(){
    $(".search-box input").focus(function(){
        $(this).parent('div').css('border','1px solid #F5C63E');
    }).blur(function(){
        $(this).parent('div').css('border','1px solid #C0C0C0');
    });
});
$(function(){
    $(".state li").click(function(){
        $(this).addClass('active').siblings('li').removeClass('active');
    })
});
$(document).ready(function(){
    //付款状态匹配
    var pay = $('table .pay-state').children('p');
    $(pay).each(function(){
        var html=$(this).html();
        if(html=="未付款"){
            $(this).css('background','#4CB1FF');
        }else if(html=="已付款待审核"){
            $(this).css('background','#40C62E');
        }else if(html=="部分付款"){
            $(this).css('background','#40C62E');
        }else if(html=="已付款"){
            $(this).css('background','#40C62E');
        }
    });
    $('table tbody tr td.isConfirm').each(function(){
        var html=$(this).html();
        if(html=="已确认"){
            $(this).siblings('td').children('.confirm').remove();
        }
    });
});
$('.state').on('click','li',function(){
	if($(this).html()=='订货单'){
		window.location.href = "/diconet/distributor/transaction_details";
	}else if($(this).html()=='退货单'){
		window.location.href = "/diconet/distributor/transaction_details_return";
	}
});
